<?php
include('../resource/db/db.php');
$pageTitle = "管理反馈";
$currentPage = "manage-feedback";
if (!isset($_COOKIE['role']) || $_COOKIE['role'] != 'admin') {
    header("Location: ../main/login.php");
    exit();
}

$sql = "SELECT * FROM feedback WHERE is_deleted=FALSE";
$result = $conn->query($sql);
?>

<!DOCTYPE html>
<html>
<head>
    <title>管理反馈</title>
    <link rel="stylesheet" href="../resource/css/styles.css">
</head>
<body>
    <?php include('../resource/navbar.php'); ?>
    <div class="container">
        <h2>管理反馈</h2>
        <ul class="list-group">
            <?php
            if ($result->num_rows > 0) {
                while($row = $result->fetch_assoc()) {
                    echo "<li class='list-group-item'>" . $row['content'] . 
                    " <a href='delete-feedback.php?feedback_id=" . $row['feedback_id'] . 
                    "' class='btn btn-danger'>删除</a></li>";
                }
            } else {
                echo "<li class='list-group-item'>暂无反馈</li>";
            }
            ?>
        </ul>
    </div>
</body>
</html>
